Scheduling VSCP events
This page describes how to automatically send events on the VSCP bus on specific, pre-determined moments. This is useful for example to every night turn off any lights that might have been left on.
Add DM row
Add a DM row to the VSCP daemon DM matrix (/srv/vscp/dm.xml):
<row enable="true" groupid="wakeup" >
<mask priority="0" class="65535" type="65535" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" > </mask>
<filter priority="0" class="65535" type="6" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" > </filter>
<control>0x0</control>
<action>0x40</action>
<param>0,20,1,0,0,37:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01,1,1,1</param>
<comment></comment>
<allowed_from>0000-01-01 00:00:00</allowed_from>
<allowed_to>9999-12-31 23:59:59</allowed_to>
<allowed_weekdays>mtwtfss</allowed_weekdays>
<allowed_time>*-*-* *:*:0/20/40</allowed_time>
<index bMeasurement="false" > 0</index>
<zone>0</zone>
<subzone>1</subzone>
</row>
Detailed explanation
Here’s a detailed explanation of the above DM row:
<row enable="true" groupid="wakeup" >
Set enable=”false” to disable the processing of this DM row. Groupid is freetext.
<mask priority="0" class="65535" type="65535" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" > </mask>
<filter priority="0" class="65535" type="6" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" > </filter>
<control>0x0</control>
<action>0x40</action>
Class CONTROL, action VSCP_DAEMON_ACTION_CODE_SEND_EVENT,0x00000040
See (VSCP daemon decision matrix docs)[http://www.vscp.org/docs/vscpd/doku.php?id=vscp_daemon_decision_matrix#actions]
<param>0,20,1,0,0,37:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01,1,1,1</param>
Event to send. Should be on the form head, class, type, obid, time-stamp, GUID, data1, data2, data3.
For a button press event; class 20, type 1, data1 (pressed/released/..)=1, data2 (zone)=1, data3 (subzone)=1
See (VSCP spec)[http://www.vscp.org/docs/vscpspec/doku.php?id=class1.information#type_1_0x01_button]
<comment></comment>
<allowed_from>0000-01-01 00:00:00</allowed_from>
<allowed_to>9999-12-31 23:59:59</allowed_to>
<allowed_weekdays>mtwtfss</allowed_weekdays>
Trigger event every day of the week. Other uses:
<allowed_weekdays>mtwtf--</allowed_weekdays>
Trigger only on working days.
<allowed_weekdays>-----ss</allowed_weekdays>
Trigger only on weekend days.
<allowed_time>*-*-* *:*:0/20/40</allowed_time>
Trigger every 20 seconds. Other uses:
<allowed_time>*-*-* *:0:*</allowed_time>
Trigger every start of the hour.
<index bMeasurement="false" > 0</index>
<zone>0</zone>
<subzone>1</subzone>
</row>
Restart vscpd
Restart the VSCP daemon so that it reads the modified DM.
/usr/local/bin/vscpd restart
To do
Use CONTROL, TurnOn and TurnOff events instead of INFORMATION, BUTTON events. Requires modification of Mespelare firmware so that it responds to these events.